var intDiff = parseInt(719); //倒计时总秒数量
function timer(intDiff) {
  window.setInterval(function () {
    var day = 0,
      hour = 0,
      minute = 0,
      second = 0; //时间默认值
    if (intDiff > 0) {
      day = Math.floor(intDiff / (60 * 60 * 24));
      hour = Math.floor(intDiff / (60 * 60)) - (day * 24);
      minute = Math.floor(intDiff / 60) - (day * 24 * 60) - (hour * 60);
      second = Math.floor(intDiff) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
    }
    if (minute <= 9) minute = '0' + minute;
    if (second <= 9) second = '0' + second;
    $('.time-d').html('<s></s>' + minute + '分'+'<s></s>' + second + '秒');
    intDiff--;
  }, 1000);
}
$(function () {
  timer(intDiff);
});
var arr = [];
arr.type = 1;
arr.order = Number($('.item-id').html());
//$('.pay-method').click(function(){
//    $('.pay-method').removeClass('active-btn');
//    $(this).addClass('active-btn');
////    $('.method-active').css('display','none');
////    $(this).find('.method-active').css('display','block');
//
//    arr.type = Number($(this).attr('id'));
//    console.log(arr);
//})
// console.log(arr);
//
$('.pay-btn').click(function(){
 console.log(arr);
    var data = {
        orderId:arr.order
    }
    $.ajax({
           url:"/fund/pay/"+arr.order+".json",
           type:"post",
            dataType:"json",
            data:JSON.stringify(data),
           success:function(data){
                console.log(data)
                $('.info-err').html('支付成功');
                location.href = '/fund?viewType=page';
            },
            error: function(msg) {
                console.log(msg)
                $('.info-err').html(msg.responseJSON.message);
            }
        })
})